<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <style>
        #myDiv {
            width: 300px;
            margin: auto;
            text-align: center;
        }

        .head {
            height: 50px;
            background-color: aqua;
            border: 1px solid black;
            line-height: 50px;

        }

        .body {
            height: 100px;
            background-color: yellowgreen;
            border: 1px solid black;
            display: none;
        }
    </style>
    <script>
        function showDiv(divId){
            var divObj=document.getElementById(divId);
            if (divObj.style.display=="block"){
                divObj.style.display="none";
            }else {
                divObj.style.display="block"
            }
        }
    </script>
</head>
<body>
<div id="myDiv">
    <div class="head" onclick="showDiv('friend')">好友</div>
    <div class="body" id="friend">
        周润发 <br>
        王嘉尔 <br>
        大司马
    </div>
    <div class="head" onclick="showDiv('love')">亲人</div>
    <div class="body" id="love">
        王德发 <br>
        DzKnow <br>
        PDD
    </div>
    <div class="head" onclick="showDiv('black')">黑名单</div>
    <div class="body" id="black">
        PGOne <br>
        blow <br>
        罗志祥
    </div>
</div>
</body>
</html>